package com.llkj.qingnianguoxue.album;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;

import com.llkj.qingnianguoxue.R;
import com.llkj.qingnianguoxue.base.BaseActivity;

import java.util.ArrayList;

/***
 * * @description
 * * 由 马君 创建于 2016年01月18日 20:16
 ***/
public class AlbumActivity extends BaseActivity {
    public static final int REQUEST_PICTURES_CODE = 9140;

    public static final String INTENT_MAX = "max";
    public static final String DATA_LIST = "data_list";

    private LocalImageShower imageShower;
    private int max;
    private int nowchecked;
    private ArrayList<String> imgList;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        max = getIntent().getIntExtra(INTENT_MAX, 1);
        imgList = getIntent().getStringArrayListExtra(DATA_LIST);
        setContentView(R.layout.activity_album);
        setTitle("选择图片", true, TITLE_TYPE_IMG, R.drawable.icon_back, true, TITLE_TYPE_TEXT, "确定");
        initStatusbar(TSATUSBAR_TYPE_BLACK_TEXT,rlTitle,R.color.gray_bar);
        tvRight.setTextColor(ContextCompat.getColor(this, R.color.color333333));
        imageShower = (LocalImageShower) findViewById(R.id.album_shower);
        imageShower.setMaxSelectedSize(max);
        if (imgList != null) {
            imageShower.setSelectedImages(imgList);
        }
    }

    @Override
    protected void rightDoWhat() {
        super.rightDoWhat();
        Intent intent = new Intent();
        intent.putStringArrayListExtra(DATA_LIST, imageShower.getSelectedImgs());
        setResult(RESULT_OK, intent);
        finish();
    }
}
